package com.cskaoyan.demo6.service;

import com.cskaoyan.demo6.bean.model.MarketSystem;
import com.cskaoyan.demo6.bean.model.MarketSystemExample;
import com.cskaoyan.demo6.mapper.MarketSystemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description：
 * @Author：BLUEBLANK
 * @Date：2024/4/20 22:24
 */

@Service("systemService")
public class SystemServiceImpl implements SystemService {
    @Autowired
    MarketSystemMapper marketSystemMapper;
    @Override
    public Map<String, String> querySystemConfig() {
        // 查小程序展示数量
        MarketSystemExample example = new MarketSystemExample();
        example.createCriteria().andKeyNameLike("%wx%");
        List<MarketSystem> marketSystems = marketSystemMapper.selectByExample(example);
        HashMap<String, String> map = new HashMap<>();
        marketSystems.forEach(marketSystem -> map.put(marketSystem.getKeyName(), marketSystem.getKeyValue()));
        return map;
    }
}
